package Thread;
class singleton{
    private static volatile  singleton instance=null;
    public static singleton getinstance(){
        if (instance==null){
            synchronized (singleton.class){
                if (instance==null){
                    instance=new singleton();
                }
            }
        }
        return instance;
    }
    private singleton(){}

}
public class Demo21 {
    public static void main(String[] args) {
        singleton s1=singleton.getinstance();
    }
}
